package cn.myxl.smart.devkit.core.util;

import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;

public class I18nUtil {
	public static final String PREFIX = "smart.devkit.";
	private static ResourceBundle bundle;

	static {
		// 指定要读取的资源包文件名和语言环境
		Locale locale = Locale.getDefault();
		bundle = ResourceBundle.getBundle("i18n.messages", locale);
	}

	public static String get(String key, String... params) {
		return get(PREFIX, key, params);
	}

	public static String get(String prefix, String key, String... params) {
		return new MessageFormat(bundle.getString(prefix + key)).format(params);
	}
}
